package org.ovirt.microvirt.services.storage;

import java.util.List;

import org.ovirt.microvirt.beans.Storage;
import org.ovirt.microvirt.services.StorageService;
import org.ovirt.microvirt.services.events.EventProcessor;
import org.springframework.orm.jpa.support.JpaDaoSupport;

public class StorageServiceImpl extends JpaDaoSupport implements StorageService {

	public StorageServiceImpl(EventProcessor eventProcessor) {
		super();
		this.eventProcessor = eventProcessor;
	}

	final EventProcessor eventProcessor;
	
	@SuppressWarnings("unchecked")
	@Override
	public List<Storage> list() {
		return getJpaTemplate().find(
				"select a from " + Storage.class.getName() + " a");
	}

	@Override
	public Storage getById(int id) {
		return getJpaTemplate().find(Storage.class, id);
	}

	@Override
	public Storage persist(final Storage storage) {
		getJpaTemplate().persist(storage);
		return storage;
	}

}
